package com.fqgj.sentry.policy.engine.eval.script

class MathUtils {

    static BigDecimal sum(... vars) {
        BigDecimal sum = 0
        vars.each {
            x ->
                def y = x.toString().toBigDecimal()
                (sum += y)
        }
        return sum
    }

    static BigDecimal mean(... vars) {
        if (vars != null && vars.length != 0) {
            return sum(vars).divide(vars.length)
        }
    }

}


